/*
 * KKTouch.cpp
 *
 *  Created on: 2013-9-15
 *      Author: wanghua
 */

#include "Classes/kaka/KKTouch.h"

KKTouch::KKTouch() {
	m_handled = true;
	m_bubbled = true;
	m_moved = false;
}

KKTouch::KKTouch(CCTouch* ccTouch) {

	m_handled = true;
	m_bubbled = true;
	m_moved = false;

	this->m_viewId = ccTouch->getID();
	this->m_point = CCDirector::sharedDirector()->convertToGL(ccTouch->getLocationInView());
	//->convertToGL(		ccTouch->locationInView(ccTouch->view()));

	this->m_rawPoint = this->m_point;

	m_prevPoint = this->m_point;
	m_prevRawPoint = m_rawPoint;

	m_firstPoint = this->m_point;
	m_firstRawPoint = m_rawPoint;
}

KKTouch::KKTouch(const KKTouch& touch) {

	copy(touch);
}

KKTouch::KKTouch(const KKTouch& touch, const CCPoint& point) {

	m_moved = touch.getIsMoved();
	m_bubbled = touch.getBubbled();
	m_handled = touch.getHandled();

	m_viewId = touch.getViewId();
	m_point = point;
	m_rawPoint = touch.getRawPoint();

	m_prevPoint = point;
	m_prevRawPoint = touch.getPrevRawPoint();

	m_firstPoint = point;
	m_firstRawPoint = touch.getFirstRawPoint();
}

void KKTouch::copy(const KKTouch& touch) {

	m_moved = touch.getIsMoved();
	m_bubbled = touch.getBubbled();
	m_handled = touch.getHandled();

	m_viewId = touch.getViewId();
	m_point = touch.getPoint();
	m_rawPoint = touch.getRawPoint();

	m_prevPoint = touch.getPrevPoint();
	m_prevRawPoint = touch.getPrevRawPoint();

	m_firstPoint = touch.getFirstPoint();
	m_firstRawPoint = touch.getFirstRawPoint();
}

KKTouch::~KKTouch() {
	// TODO Auto-generated destructor stub
}

CCPoint KKTouch::getFling() {
	return ccp(m_point.x - m_firstPoint.x, m_point.y - m_firstPoint.y);
}
